package com.xbongbong.pro.statistic.pojo;

import com.xbongbong.paas.bi.pojo.DataSetNodeGroupPojo;
import com.xbongbong.paas.bi.pojo.DataSetNodeInputPojo;
import com.xbongbong.paas.bi.pojo.DataSetNodeJoinPojo;
import com.xbongbong.paas.bi.pojo.DataSetNodeOutputPojo;
import com.xbongbong.paas.bi.pojo.DataSetNodeUnionPojo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 节点信息pojo
 * @author zcp
 * @version v1.0
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class DataSetBoardSaveInfoPojo implements Serializable {
    /**
     * 数据源节点
     */
    private List<DataSetNodeInputPojo> inputNodeList;
    /**
     * 合并节点
     */
    private List<DataSetNodeUnionPojo> unionNodeList;
    /**
     * 连接节点
     */
    private List<DataSetNodeJoinPojo> joinNodeList;
    /**
     * 分组汇总节点
     */
    private List<DataSetNodeGroupPojo> groupNodeList;
    /**
     * 输出节点
     */
    private List<DataSetNodeOutputPojo> outputNodeList;

    public void addInputNodeList(DataSetNodeInputPojo pojo){
        if (Objects.isNull(inputNodeList)) {
            inputNodeList = new ArrayList<>();
        }
        inputNodeList.add(pojo);
    }
    public void addUnionNodeList(DataSetNodeUnionPojo pojo){
        if (Objects.isNull(unionNodeList)) {
            unionNodeList = new ArrayList<>();
        }
        unionNodeList.add(pojo);
    }
    public void addJoinNodeList(DataSetNodeJoinPojo pojo){
        if (Objects.isNull(joinNodeList)) {
            joinNodeList = new ArrayList<>();
        }
        joinNodeList.add(pojo);
    }
    public void addGroupNodeList(DataSetNodeGroupPojo pojo){
        if (Objects.isNull(groupNodeList)) {
            groupNodeList = new ArrayList<>();
        }
        groupNodeList.add(pojo);
    }
    public void addOutputNodeList(DataSetNodeOutputPojo pojo){
        if (Objects.isNull(outputNodeList)) {
            outputNodeList = new ArrayList<>();
        }
        outputNodeList.add(pojo);
    }
}
